<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>订单</title>
	<link rel="stylesheet" type="text/css" href="./Public/Home/css/dingdan.css"/>
	<script src="./Public/Home/js/jquery.min1.9.js" type="text/javascript" charset="utf-8"></script>
	<script src="./Public/Home/js/index.js" type="text/javascript" charset="utf-8"></script>
	<script src="./Public/Home/js/area.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="./Public/Home/css/sanji.css"/>
	<script>
		$(function () {
//			alert(1);
			$('.button-light').click(function () {
//				alert(1);
                $(this).parents('.field').siblings('.address-create').show();
			})
            $('.save').click(function () {
                $(this).parents('.address-create').hide();
            })
		})
	</script>
	<script>
		$(function () {
//			alert(1);
			$('.save').click(function () {
				//表单序列化
				var data = $('.g').serialize();
				data = decodeURIComponent(data,true);
//				alert(data);
				$.ajax({
					type:'post',
					url:'{{U('Address/add')}}',
					data:data,
                    dataType:'json',
                    success:function(phpData){
//					alert(phpData);
					var html = '<li style="height: 44px; margin-left: 33px;"><input type="radio" name="addressid" value="'+phpData.aid+'">';
					html+='&nbsp;&nbsp;&nbsp;&nbsp;'+phpData.aname
					html+='&nbsp;&nbsp;&nbsp;&nbsp;'+phpData.aphone;
					html+='&nbsp;&nbsp;&nbsp;&nbsp;'+phpData.aaddress;
					html+='&nbsp;&nbsp;&nbsp;&nbsp;'+phpData.amail;
					html+=' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+'<a href="">删除</a>'+'</li>';
//						alert(html);
					$('#address ul').append(html);
                    }



				})

			})
		})


	</script>
</head>
<body>
	{{include file="../Common/header"}}
	<!--导航区域结束-->
	<div class="main-content ">
		<div class="wrapper">
			<ul class="breadcrumb">
				<li>
					<a href="">首页</a>
					<span>/</span>
				</li>
				<li>
					购物车
				</li>
			</ul>
			<div class="brick-bottom">
				<ul class="steps">
					<li class="one">
						<div class="step-content">
							<h5 class="step-heading">购物车</h5>
							<div class="step-gradient"></div>
						</div>
					</li>

					<li class="two">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>
						</div>
					</li>

					<li class="there">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>

						</div>
					</li>
				</ul>
				
				<form action="" method="post" class="g">
					<div class="delivery-header" style="margin-bottom: 20px;">
						<h1 class="h-epsilon">
							选择配送方式:
						</h1>
					</div>
                    <div id="address">
                        <ul>
                            {{foreach from="$addressData" value="$v"}}
                                <li style="height: 44px; margin-left: 33px"><input type="radio" name="addressid" value="{{$v['aid']}}">&nbsp;&nbsp;&nbsp;&nbsp;{{$v['aname']}}&nbsp;&nbsp;&nbsp;&nbsp;{{$v['aphone']}}&nbsp;&nbsp;&nbsp;&nbsp;{{$v['aaddress']}}&nbsp;&nbsp;&nbsp;&nbsp;{{$v['amail']}}
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="{{U('Address/del',array('aid'=>$v['aid']))}}">
                                        删除
                                    </a></li>
                            {{endforeach}}
                        </ul>
                    </div>
					<div class="brick-shadow">
						<p class="field">
							<a href="javascript:;" class="button-light">
								添加新地址
							</a>
						</p>
						<div class="address-create" style="display: none">
							<div class="con">
								<label>*收货人姓名</label>
								<input type="text" name="aname" id="" class="uname" value="" />
							</div>
							
							<div class="tel">
								<label>*手机号码</label>
								<input type="text" name="aphone" class="phone"/>
							</div>
							<div class="address">
								<label>*收货地址</label>
								
								<div class="info">
									<div>
										<select id="s_province" name="aaddress[]" ></select>  
									    <select id="s_city" name="aaddress[]" ></select>  
									    <select id="s_county" name="aaddress[]"></select>
									    <script class="resources library" src="area.js" type="text/javascript"></script>
									    
									    <script type="text/javascript">_init_area();</script>
								    </div>
									    <div id="show"></div>
									</div>
									<script type="text/javascript">
									var Gid  = document.getElementById ;
									var showArea = function(){
										Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" + 	
										Gid('s_city').value + " - 县/区" + 
										Gid('s_county').value + "</h3>"
																}
									Gid('s_county').setAttribute('onchange','showArea()');
									</script>
									<input type="text" name="address-detail" class="address-detail" placeholder="详细街道地址"/>
								
							</div>
							
							<div class="emal">
								<label>邮箱</label>
								<input type="text" name="amail" class="mail"/>
							</div>
							
							<div class="form-actions">
								<div class="pull-left">
									<a href="javascript:void(0);" class="save">保存</a>
									<a href="javascript:;" class="cancel">取消</a>
									
								</div>
								
								
							</div>
						</div>
						
					</div>
						<div class="payment_method_filed">
							<div class="payment_method">
								<span class="h-epsilon">支付方式:</span>
								<div class="g-wrapper">
									<div class="payment">
										<span class="radio"></span>
										<h3 class="main">在线支付</h3>
									</div>
								</div>
							</div>
						</div>
						
						<div class="brick">
							<div class="brica">
								<div class="brick-shadow">
									<h4>商品清单：</h4>
									{{foreach from="$_SESSION['cart']['goods']" key="$k" value="$v"}}
										<div class="goods-list">
										<div class="goods-list-show">
											<a href="">
												<img src="./Public/Home/images/shouji1.jpg" style="width: 111px;height: 129px;"/>
											</a>
										</div>
										<div class="goods-list-detail">
											<div class="goods-list-info">
												<div class="goods-list-description">
													<h4 class="heading">
														<a href="" class="money">
															{{$v['name']}}
														</a>
														{{foreach from="$v['options']['type']" value="$value"}}
															<p class="xinghao">{{$value}}</p>
														{{endforeach}}
													</h4>
												</div>
												<div class="goods-list-quantity">
													<strong>×{{$v['num']}}</strong>
												</div>
												<div class="goods-list-price">
													<strong>￥{{$v['total']}}</strong>
													
												</div>
											</div>
										</div>
									</div>
									{{endforeach}}
								</div>
							</div>
						</div>
						
						<div class="fee-list">
							<ul class="free">
								<li>
									<span class="fee-title">商品数量：</span>
									<span class="fee-num">{{$num}}</span>
									
								</li>
								
								<li>
									<span class="fee-title">应付金额：</span>
									<span class="fee-price">￥{{$total}}</span>
									
								</li>
							</ul>
						</div>
						<div class="form-actions">
							<div class="right-text">
									<button class="sumbit">提交订单</button>
							</div>
						</div>
                    <input type="hidden" value="$_GET['aid']">

				</form>
			</div>
		</div>
	</div>
	
	

	

	
	

	<!--公共底部-->
{{include file="../Common/footer"}}
</body>
</html>